#include "status.h"
#define list_init_size 100

typedef int keytype;

typedef struct{
	keytype key;
	elemtype elem;
	char * dat;

}redtype;

typedef struct {
	redtype *r;
	int length;
}sqlist;



status init_list(sqlist *l);

void destroy_list(sqlist *l);

void clear_list(sqlist *l);
/*judge whether it is empty*/
status is_empty(sqlist *l);

int get_length(sqlist *l);

status get_elem(sqlist *l,int i,redtype* e);

typedef int (*func_cmp)(redtype,redtype);
typedef int (*func_cmp_elem)(elemtype,elemtype);

int locate_elem(sqlist *l,elemtype e,func_cmp_elem op);

status prior_elem(sqlist *l,elemtype cur_e,redtype* pre_e);

status next_elem(sqlist *l,elemtype cur_e,redtype** next_e);

status list_insert(sqlist *l,int i,elemtype e);

status list_delete_elem(sqlist *l,elemtype e);

status list_delete(sqlist *l,int i);

typedef void (*func_visit)(redtype);

void list_traverse(sqlist *l,func_visit);

status print_list_elem(sqlist*l);
